﻿using AutoMapper;
using BW.MesProject.Public.ErrorCode;
using BW.MesProject.Public.Infrastructure;
using BW.MesProject.WareHouse.Domain;
using BW.MesProject.WareHouse.Infrastructure;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace BW.MesProject.WareHouse.Application
{
    /// <summary>
    /// 供应商
    /// </summary>
    public class SupplierServices : ISupplierServices
    {
        private readonly IBaseRepository<SupplierModel> _Supplier;
        private readonly IMapper _mapper;
        /// <summary>
        /// 构造函数
        /// </summary>
        /// <param name="Supplier"></param>
        /// <param name="mapper"></param>
        public SupplierServices(IBaseRepository<SupplierModel> Supplier, IMapper mapper)
        {
            _Supplier = Supplier;
            this._mapper = mapper;
        }


        /// <summary>
        /// 查询供应商
        /// </summary>
        /// <param name="SupplierName"></param>
        /// <returns></returns>
        public ApiResult<List<SupplierModel>> GetSupplier(string? SupplierName)
        {
            int totalCount = 0;
            //查询名称来显示数据
            var list = _Supplier.GetAll();
            List<SupplierModel> Supplierlist = new List<SupplierModel>();
            Supplierlist = list.OrderBy(u => u.SupplierId).ToList();
            return new ApiResult<List<SupplierModel>>()
            {
                Code = ApiEnums.Success,
                Message = "查询成功",
                Data = Supplierlist.ToList(),
                TotalCount = 0,
            };
        }

    }
}
